package com.wwm.makerandroid.makerandroid.Service;


import com.wwm.makerandroid.makerandroid.Bean.RespondBean.MessageBean;
import com.wwm.makerandroid.makerandroid.Bean.ViewBean.LeaveClearance;

import java.io.File;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;

public interface UserService {

    //表示提交表单数据，@Field注解键名
    //适用于数据量少的情况
    @POST("/user/login")
    @FormUrlEncoded
    Call<MessageBean> login(@Field("userNumber") String userNumber, @Field("password") String password);

    @FormUrlEncoded
    @POST("/user/register")
    Call<MessageBean> register(@Field("userNumber") String userNumber, @Field("password") String password);

    //    @FormUrlEncoded
//    @POST("addArticle")
//    Call<MessageBean> addArticle(@Field("userNumber") String userNumber, @Field("collectUrl") String collectUrl, @Field("collectTitles") String collectTitles);
//
//    @FormUrlEncoded
//    @POST("findAllArticle")
//    Call<UserCollectArticleBean> findAllArticle(@Field("userNumber") String userNumber);
//
//    @FormUrlEncoded
//    @POST("deleteArticle")
//    Call<MessageBean> deleteArticle(@Field("userNumber") String userNumber, @Field("collectUrl") String collectUrl);
//    @FormUrlEncoded
//    @GET("deleteArticle")
//    Call<MessageBean> getUserAllApply(@Field("userNumber") String userNumber, @Field("collectUrl") String collectUrl);
    @FormUrlEncoded
    @GET("deleteArticle")
    Call<MessageBean> getUserAllApply(@Field("userNumber") String userNumber, @Field("collectUrl") String collectUrl);
//    ++++++++++++++++++++++++++++++++++++以下为请假系统新增API++++++++++++++++++++++++++++++++++++++++

    @POST("leave-apply/addApply")
    Call<MessageBean> addapply(@Body() RequestBody applyBean);

    //    获得用户请假记录
    @FormUrlEncoded
    @POST("leave-apply/getUserAllApply/")
    Call<ResponseBody> getUserAllRecord(@Field("userNumber") String userNumber);


    @FormUrlEncoded
    @POST("user/approvers")
    Call<MessageBean> getUserAllapprovers(@Field("userNumber") String userNumber);

    @FormUrlEncoded
    @POST("leave-apply/getLastRefuseApply")
    Call<ResponseBody> getLastRefuseApply(@Field("userNumber") String userNumber);

    //   获取上一个未销假的申请
    @FormUrlEncoded
    @POST("leave-apply/getLastNotClearanceApply")
    Call<ResponseBody> getLastNotClearanceApply(@Field("userNumber") String userNumber);

    /**
     * 提交销假申请
     *
     * @return
     */
    @POST("/leaveApply/leave-clearance/add")
    Call<MessageBean> addClearanceApply(@Body() RequestBody clearanceApply);


    @POST("/upload")
    Call<MessageBean> uploadFile(@Body() RequestBody applyBean);


    @FormUrlEncoded
    @POST("leave-apply/getWaitApproval")
    Call<ResponseBody> getWaitApproval(@Field("userNumber") String userNumber);


    //    获取上一个等待审批的请假申请
    @FormUrlEncoded
    @POST("leave-apply/getLastwaitForApproverApply")
    Call<ResponseBody> getLastwaitForApproverApply(@Field("userNumber") String userNumber);

    //    获取上一个等待审批的销假申请
    @FormUrlEncoded
    @POST("/leaveApply/leave-clearance/getLastwaitForApproverclearance")
    Call<ResponseBody> getLastwaitForApproverclearance(@Field("userNumber") String userNumber);

    //

    /**
     * 审核  发送通过/拒绝请假、销假申请请求  拒绝的话必须带上拒绝理由（mark）
     *
     * @param userNumber 当前用户账号
     * @param applyId    请假申请id
     * @param isTongguo  是否通过
     * @param mark       备注
     * @param type       审批类型  1:审批请假 2:审批销假
     * @return
     */
    @FormUrlEncoded
    @POST("leave-apply/shenhe/leave")
    Call<ResponseBody> shenhe(@Field("userNumber") String userNumber, @Field("applyId") String applyId,
                              @Field("isTongguo") Boolean isTongguo, @Field("remark") String mark, @Field("type") int type);


    //    http://localhost:9050/leave-apply/tongji?date=2023-10-12 12:45:00&jingguo=南京
    @FormUrlEncoded
    @POST("leave-apply/tongji")
    Call<ResponseBody> tongji(@Field("date") String date, @Field("jingguo") String jingguo);


}
